Release 10.1A: OpenEdge Development:
AppBuilder
Access section (adeuib/_accsect.p)
Use the
adeuib/_accsect.pprocedure to read and write code sections in AppBuilder:
Input parameters
The
adeuib/_accsect.pprocedure takes the following input parameters:pc_modeA quoted character string that specifies the mode of operation. Valid values are:
“GET”— Reads the contents of the section or returns unknown (?).“SET”— Writes the contents of the section.“DELETE”— Deletes the current section.You cannot actually delete either the
MAIN-CODE-BLOCKor theDEFINITIONSsections (seepc_sectionbelow). TheDELETEvalue empties the section but does not also remove the stub.pi_contextThe context ID of the object to access. If unknown (
?), AppBuilder assumes the current window or procedure.pc_sectionThe name of the code section to access. Valid values are:
DEFINITIONSMAIN-CODE-BLOCKTRIGGER:event-name
(For example,TRIGGER:CHOOSE)PROCEDURE:name:handler(For example,PROCEDURE:mytest:maintain.p. See the “Examples” section below for a description of how you can use this.)FUNCTION:nameXFTR:xftr-nameWhen you have a
TRIGGER, thenpi_contextrefers to a widget. In all other cases,pi_contextpoints to the procedure.If
pi_srecidis unknown (?), thenpi_contextandpc_sectionare used to identify an existing section. Ifpi_srecidis known, thenpc_sectionis ignored.Input-output parameters
The
adeuib/_accsect.pprocedure uses the followingINPUT-OUTPUTparameters:pi_srecidThe context ID of the current section. If its value is other than unknown,
pc_sectionis ignored.pc_codeThe contents of the trigger or other code section.
Return values
This procedure returns:
“Error”Indicates that
pi_contextis not specified and there is no current procedure or window.Examples
The following code resets the
MAIN-CODE-BLOCKto an include file:
The following example creates a AppBuilder-maintained procedure: a procedure that the Code Section Editor displays as a
READ-ONLYprocedure. The following code fragment callsadeuib/_accsect.p:
In this example:
- The first
INPUTparameter,“SET”:U, specifiesSETmode;SETmode tellsadeuib/_accsect.pto write or create a code section.- The second
INPUTparameter,?, specifies the context ID of the object to access. By default,adeuib/_accsect.pinterprets the unknown value (?) to be the context ID of the current window or procedure.- The third
INPUTparameter,“PROCEDURE:mytest:maintain.p”, specifies the following:- The first INPUT-OUTPUT parameter specifies the context ID of the section; this value must be unknown (
?) orpc_sectionis ignored.- The final INPUT-OUTPUT is a character string that holds the contents of the section.
This
maintain.pprocedure generates the code for the mytest internal procedure:
The
maintain.pprocedure generates a mytest procedure that the Code Section Editor displays as read only. Here are the contents of the generated mytest procedure:
AppBuilder-maintained procedures provide an alternative to traditional
XFTRuse. They basically fill the role of anXFTRwith only a singleWRITEhandler. The advantages of AppBuilder-maintained procedures overusingXFTRare:Their disadvantages are:
- They can be deleted by the user from the Code Section Editor menu (Edit/Delete Procedure).
- They cannot store data in comments used to rebuild the code section. That is, the contents of the AppBuilder-maintained procedure must be derived totally from external sources or calls to
adeuib/_uibinfo.p. For example, anXFTRhandler can read a section and have it affect what it generates; however, an AppBuilder-maintained procedure can only write code.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |